home *** CD-ROM | disk | FTP | other *** search
- property ancestor, mysteryLocList, nextLoc, policeCounter, policeDelayList, flashTimer, keyPressed, bluesWarnings, beenSetCaught, carMemory
- global gCarObj, noWayBubList, locateBubList, policeBubList, RADARSPRITES, BANDSPRITES, LIFESPRITE, CURSORINDEX, COUNTDOWNSTRIP, VIDEOSPRITE
-
- on new me
- set ancestor to new(script "carScript")
- return me
- end
-
- on init me, timeDelayList, locList
- set policeDelayList to timeDelayList
- set mysteryLocList to locList
- set flashTimer to 0
- set bluesWarnings to 3
- set beenSetCaught to 0
- set keyPressed to 0
- set nextLoc to 1
- set policeCounter to 0
- append(the actorList, me)
- end
-
- on stepFrame me
- mainRoutine(me)
- bubbleRoutine(me)
- end
-
- on bubbleRoutine me
- if policeBubList <> [] then
- repeat with i = 1 to count(policeBubList)
- customstepframe(getAt(policeBubList, i))
- end repeat
- end if
- end
-
- on mainRoutine me
- case the frameLabel of
- "normal":
- if nextLoc > 8 then
- cursor(-1)
- killLastGame(1)
- toggleGamePuppets(0)
- go("complete")
- else
- policeRoutine(me)
- radarRoutine(me)
- checkMovement(me)
- flashBand(me)
- end if
- "located":
- set myName to getName(me, nextLoc + (BANDSPRITES - 2))
- set the member of sprite (nextLoc + (BANDSPRITES - 2)) to member (myName & "3.PCT")
- set the member of sprite (nextLoc + (BANDSPRITES - 2)) to member (myName & "1.PCT")
- end case
- end
-
- on reverseAllPolice me
- if count(the actorList) > 2 then
- repeat with i = 3 to count(the actorList)
- set myObject to getAt(the actorList, i)
- set the goingInReverse of myObject to 1
- set the carXpos of myObject to 1
- set the carYpos of myObject to 1
- end repeat
- end if
- end
-
- on setCaught me
- reverseAllPolice(me)
- if not beenSetCaught then
- set beenSetCaught to 1
- set bluesWarnings to bluesWarnings - 1
- set the member of sprite LIFESPRITE to member ("lives" & bluesWarnings & ".PCT")
- if bluesWarnings > 0 then
- go("warning")
- else
- set bluesWarnings to 3
- go("jailed")
- end if
- end if
- end
-
- on checkMovement me
- if the mouseDown then
- evaluateCursorAppearance(me, the CAR of gCarObj, 1)
- else
- if keyPressed = 0 then
- killBubbles(me, noWayBubList)
- evaluateCursorAppearance(me, the CAR of gCarObj, 0)
- else
- cursor(-1)
- end if
- end if
- end
-
- on createBubble me, whichScript, whichList, whichMember
- if whichList = [] then
- set horPos to the locH of sprite the CAR of gCarObj
- set verPos to the locV of sprite the CAR of gCarObj
- if horPos < 280 then
- set xPos to horPos + 15
- set hCode to 4
- else
- set xPos to horPos - 15
- set hCode to 2
- end if
- if verPos < 180 then
- set yPos to verPos + 15
- set vCode to 1
- else
- set yPos to verPos - 15
- set vCode to 3
- end if
- set bubbleObj to new(script whichScript)
- if voidp(whichMember) then
- set whichMember to getAt(["ste", "don", "mur", "wil", "lou", "tom", "mat", "aln"], nextLoc - 1)
- end if
- appear(bubbleObj, xPos, yPos, whichMember & vCode & hCode & ".PCT", whichList)
- end if
- end
-
- on killBubbles me, myList
- if myList <> [] then
- repeat with i = 1 to count(myList)
- destroy(getAt(myList, i))
- end repeat
- end if
- end
-
- on blankCar me, blankState
- if blankState then
- if the memberNum of sprite the CAR of gCarObj > 0 then
- set carMemory to the name of the member of sprite the CAR of gCarObj
- set the memberNum of sprite the CAR of gCarObj to 0
- end if
- else
- set the member of sprite the CAR of gCarObj to member carMemory
- end if
- end
-
- on policeRoutine me
- set policeDelay to getAt(policeDelayList, nextLoc)
- if policeCounter = 0 then
- createPolice(me)
- else
- if policeCounter > 4 then
- set the locH of sprite COUNTDOWNSTRIP to 0
- else
- if the timer > (policeDelay * 60) then
- createPolice(me)
- else
- set newPos to abs((the timer * (640.0 / (policeDelay * 60))) - 640)
- set the locH of sprite COUNTDOWNSTRIP to newPos
- end if
- end if
- end if
- if the timer > 60 then
- killBubbles(me, policeBubList)
- end if
- end
-
- on radarRoutine me
- if not (the carIsDrivingHori of gCarObj) and not (the carIsDrivingVert of gCarObj) then
- set radarX to abs(getIndex(me, mysteryLocList, nextLoc, 1) - the finalXpos of gCarObj)
- set radarY to abs(getIndex(me, mysteryLocList, nextLoc, 2) - the finalYpos of gCarObj)
- set radarReading to integer(sqrt(power(radarX, 2) + power(radarY, 2)))
- repeat with i = 1 to 15
- if radarReading < i then
- set the member of sprite (i + (RADARSPRITES - 1)) to member ("lit" & i & ".PCT")
- next repeat
- end if
- set the member of sprite (i + (RADARSPRITES - 1)) to member ("off" & i & ".PCT")
- end repeat
- if (radarX = 0) and (radarY = 0) then
- set nextLoc to nextLoc + 1
- reverseAllPolice(me)
- go("located")
- end if
- end if
- end
-
- on createPolice me
- createBubble(me, "movingBubbleScript", policeBubList, "roll")
- set policeCounter to policeCounter + 1
- set policeCarObj to new(script "policeScript")
- init(policeCarObj, 13, 9, 2)
- if not soundBusy(2) then
- playSound(me, 2, "siren")
- end if
- startTimer()
- end
-
- on playSound me, whichChannel, whichSound
- puppetSound(whichChannel, 0)
- puppetSound(whichChannel, member whichSound)
- end
-
- on flashBand me
- if nextLoc < 8 then
- set flashTimer to flashTimer + 1
- if flashTimer > 10 then
- set flashTimer to 0
- set myName to getName(me, nextLoc + (BANDSPRITES - 1))
- set myID to getID(me, nextLoc + (BANDSPRITES - 1))
- if myID = "2" then
- set the member of sprite (nextLoc + (BANDSPRITES - 1)) to member (myName & "1.PCT")
- else
- set the member of sprite (nextLoc + (BANDSPRITES - 1)) to member (myName & "2.PCT")
- end if
- end if
- end if
- end
-
- on resetBand me
- repeat with i = BANDSPRITES to BANDSPRITES + 6
- set myName to getName(me, i)
- set the member of sprite i to member (myName & "3.PCT")
- end repeat
- end
-
- on evaluateCursorAppearance me, whichSprite, mouseDownFlag
- set indexH to the mouseH - the locH of sprite whichSprite
- set indexV to the mouseV - the locV of sprite whichSprite
- set evaluateInMiddleH to (indexH > -21) and (indexH < 21)
- set evaluateNotInMiddleV to (indexV < -20) or (indexV > 20)
- if evaluateInMiddleH then
- if evaluateNotInMiddleV then
- set notInCenter to 1
- else
- set notInCenter to 0
- end if
- else
- set notInCenter to 1
- end if
- if notInCenter then
- set evaluateNegativeX to indexH < 0
- set evaluatePositiveX to indexH > 0
- if evaluatePositiveX then
- set lessThan to indexH
- set greaterThan to -(indexH + 1)
- else
- if evaluateNegativeX then
- set lessThan to -(indexH - 1)
- set greaterThan to indexH
- else
- set lessThan to 0
- set greaterThan to 0
- end if
- end if
- set evaluateNegativeY to indexV > greaterThan
- set evaluatePositiveY to indexV < lessThan
- if evaluateNegativeY and evaluatePositiveY then
- if evaluatePositiveX then
- if mouseDownFlag then
- cursor([CURSORINDEX + 3, CURSORINDEX + 3])
- checkCar(gCarObj, 2)
- else
- cursor([CURSORINDEX + 2, CURSORINDEX + 3])
- end if
- else
- if evaluateNegativeX then
- if mouseDownFlag then
- cursor([CURSORINDEX + 7, CURSORINDEX + 7])
- checkCar(gCarObj, 4)
- else
- cursor([CURSORINDEX + 6, CURSORINDEX + 7])
- end if
- end if
- end if
- else
- if evaluateNegativeY then
- if mouseDownFlag then
- cursor([CURSORINDEX + 5, CURSORINDEX + 5])
- checkCar(gCarObj, 3)
- else
- cursor([CURSORINDEX + 4, CURSORINDEX + 5])
- end if
- else
- if evaluatePositiveY then
- if mouseDownFlag then
- cursor([CURSORINDEX + 1, CURSORINDEX + 1])
- checkCar(gCarObj, 1)
- else
- cursor([CURSORINDEX, CURSORINDEX + 1])
- end if
- end if
- end if
- end if
- else
- if mouseDownFlag then
- cursor([CURSORINDEX + 9, CURSORINDEX + 9])
- else
- cursor([CURSORINDEX + 8, CURSORINDEX + 9])
- end if
- end if
- end
-
- on getName me, whichSprite
- set myName to the name of the member of sprite whichSprite
- return chars(myName, 1, the length of myName - 5)
- end
-
- on getID me, whichSprite
- set myName to the name of the member of sprite whichSprite
- return chars(myName, the length of myName - 4, the length of myName - 4)
- end
-